<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script src="./Promise.js"></script>

    <script>
      //实例化 Promise 对象
      let p = new Promise((resolve, reject) => {
        //改变 promise 状态的方式
        // reject('ABC');
        resolve("OK");
      });

      //函数调用小括号中的是『实参』
      //函数声明时小括号中的是『形参』
      // p.catch(reason => {
      //   console.log(reason);
      // }).then(v => {
      //   console.log(v);
      // })

      //异常穿透 与 值传递
      p.
      catch(r => {
        console.log(r)
      })
      .then(v => {
        console.log(v);
      }).then(v => {
        console.log(v);
      }).catch(r => {
        console.dir(r);
      })

      

    </script>
  </body>
</html>
